import Sequelize from 'sequelize';
import baseDao from '../lib/baseDao.js'; // 数据库操作
import User from './user.js'

const Modal = baseDao.sequelize.define('t_trade_foreign', {
  // 属性
  id: {
    type: Sequelize.INTEGER,
    primaryKey: true, // 主键
    autoIncrement: true, // 自增
    allowNull: true,
    validate: {
      len: [1, 50]
    }
  },
  receiptNumber: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 200]
    },
    comment: '发票号'
  },
  saleNumber: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '销售合同号'
  },
  month: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 20]
    },
    comment: '月份'
  },
  shipman: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 20]
    },
    comment: '船务员'
  },
  loadingAt: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '装柜日期'
  },
  customerService: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 20]
    },
    comment: '客户专员'
  },
  CY: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: 'CY'
  },
  bargeEtd: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '驳船ETD'
  },
  shipEtd: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '大船ETD'
  },
  ETA: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: 'ETA'
  },
  bookingNumber: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '订舱号'
  },
  customClearanceAt: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '报关放行进度'
  },
  documentAt: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '单证进度'
  },
  number: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '数量LCL请填写LCL'
  },
  cabinetType: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '柜型(LCL请备注体积）'
  },
  shipPort: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '装船港'
  },
  shipCompany: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '船公司'
  },
  cabinetNumber: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '柜号'
  },
  sealNumber: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '封条号'
  },
  licensePlate: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '车牌'
  },
  driverMobile: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '司机电话'
  },
  localFreightForward: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '本地货代'
  },
  scheduleRemark: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '船期进度备注'
  },
  seaFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '海运费'
  },
  trailerFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '拖车费'
  },
  customClearanceFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '报关费'
  },
  billingFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '打单费'
  },
  changeOrderFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '异提费/改单费'
  },
  arkFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '约柜费'
  },
  scanFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '扫描费'
  },
  arivalFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '入仓费'
  },
  retreat: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '退点'
  },
  overheadFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '高速费'
  },
  otherFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '其他费用填写费用后批注是什么费用'
  },
  totalFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '费用合计'
  },
  originCertificateType: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '产地证类型'
  },
  originCertificateFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '产地证费用'
  },
  receiveDnAt: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '收到DN时间'
  },
  shipPortFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '港杂费'
  },
  money: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '私户/公户/港币/美金'
  },
  foreignFreightForward: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '外地货代'
  },
  shipPortAt: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '外地港杂付款时间'
  },
  payAt: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '收到财务部付款水单时间点'
  },
  boatDay: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '提单开船日'
  },
  ladingAt: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '收到提单时间'
  },
  Cabinet: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '正本/电放/EXW/拼柜'
  },
  receiveDeliveryNumber: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '提单快递单号'
  },
  receiptRemark: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '收单进度备注'
  },
  deliveryFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '收单快递费用'
  },
  billingAt: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '寄单/电放时间'
  },
  uploadAt: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '议付时间（提交财务部时间）'
  },
  deliveryNumber: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '寄单单号'
  },
  deliveryFee: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '寄单费用'
  },
  payType: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '付款方式'
  },
  invoicePrice: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '发票金额'
  },
  creditNumber: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '信用证号码'
  },
  creditTerm: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '信用证付款条款'
  },
  term: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '即期/远期'
  },
  userId: {
    type: Sequelize.INTEGER,
    allowNull: true,
    validate: {
      len: [1, 50]
    },
    comment: '导入者ID'
  }
}, {
    // 参数
  });

Modal.belongsTo(User.Modal, { foreignKey: 'userId', targetKey: 'id', as: 'user' });

//向外暴露
export default {
  Modal,
}